package com.plian.system.wrapper.fr.enterprise;

import com.plian.system.dto.fr.enterprise.EnterpriseDTO;
import com.plian.system.entity.fr.enterprise.Enterprise;
import com.plian.system.mybatis.support.BaseWrapper;
import com.plian.system.vo.fr.enterprise.EnterpriseVO;
import com.plian.system.wrapper.util.CacheWrapperUtil;
import com.plian.system.wrapper.util.WrapperUtil;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import static com.plian.system.wrapper.util.WrapperConstant.*;

/**
 * 评估师信息包装类,返回视图层所需的字段
 *
 * @author jianglei
 * @since 2019-10-21
 */
@Mapper(componentModel = SPRING, uses = {CacheWrapperUtil.class, WrapperUtil.class})
public interface EnterpriseWrapper extends BaseWrapper<Enterprise, EnterpriseDTO, EnterpriseVO> {

	@Override
	@Mappings(value = {
			@Mapping(source = "orgId", target = "orgName", qualifiedByName = ORG_ID_TO_NAME),
			@Mapping(source = "superiorOrgName", target = "superiorOrgNameStr", qualifiedByName = ORG_ID_TO_NAME),
			@Mapping(source = "subordinateToGroup", target = "subordinateToGroupName", qualifiedByName = ORG_ID_TO_NAME),
			@Mapping(source = "scaleOperation", target = "scaleOperationName", qualifiedByName = DICT_CODE_TO_NAME),
			@Mapping(source = "businessSector", target = "businessSectorName", qualifiedByName = DICT_CODE_TO_NAME),
			@Mapping(source = "functionalClassification", target = "functionalClassificationName", qualifiedByName = DICT_CODE_TO_NAME),
			@Mapping(source = "industry", target = "industryName", qualifiedByName = DICT_CODE_TO_NAME),
			@Mapping(source = "isEnterprise", target = "isEnterpriseStr", qualifiedByName = DICT_CODE_TO_NAME)
	})
	EnterpriseVO entityToVO(Enterprise entity);
}
